/**
 * https://hydro.ac/d/HUNNU/p/DataStructure0005
 * 对每个点求严格左下、右下、右上、左上的点的数量
 * 设置好比较器，直接排序、归并即可
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>
using namespace __gnu_pbds;

using Real = long double;
using llt = long long;
using vi  =vector<int>;
using pii = pair<int, int>;
using vvi = vector<vi>;
using vpii = vector<pii>;

struct cdq_t{ // 二维偏序，第一维必须各不相同?

using value_t = int;

struct _t{
    value_t x;
    value_t y;
    int pos;
};

int N;
vector<_t> A, B;
vector<int> Ans;

// 第一维比较器
function<bool(value_t, value_t)> cmp1;
// 第二维比较器
function<bool(value_t, value_t)> cmp2;


cdq_t():cmp1(nullptr),cmp2(nullptr){}

cdq_t(function<bool(value_t, value_t)> c1, function<bool(value_t, value_t)> c2):cmp1(c1),cmp2(c2){}

void setCmp(function<bool(value_t, value_t)> c1, function<bool(value_t, value_t)> c2){
    this->cmp1 = c1; this->cmp2 = c2;
}

void input(){
    cin >> N;
    A.assign(N, {});
    B.assign(N, {});
    for(int i=0;i<N;++i) cin >> A[A[i].pos = i].x >> A[i].y;
}

void run() {
    Ans.assign(N, 0);    
    sort(A.begin(), A.end(), [this](const _t & a, const _t & b){
        if(a.x != b.x) return this->cmp1(a.x, b.x);
        if(a.y != b.y) return this->cmp2(a.y, b.y);
        return a.pos < b.pos;
    });
    CDQ(0, N - 1);
}

void CDQ(int s, int e) {
    if(s >= e) return;

    int mid = (s + e) >> 1;
    CDQ(s, mid); CDQ(mid + 1, e);

    int u = s, v = mid + 1, t = s;
    while(u <= mid and v <= e){
        if(cmp2(A[u].y, A[v].y)){
            B[t++] = A[u++];
        }else{ // 否时才统计, 说明u前面的点都是v的答案
            Ans[A[v].pos] += u - s;
            B[t++] = A[v++]; 
        }    
    }
    while(u <= mid){
        B[t++] = A[u++];
    }
    while(v <= e){
        Ans[A[v].pos] += u - s;
        B[t++] = A[v++]; 
    }

    copy(B.begin() + s, B.begin() + e + 1, A.begin() + s);
    return;
}

}CDQ;

void proc(){
    CDQ.input();

    vector<array<int, 4>> ans(CDQ.N);

    // 两维都小，左下
    CDQ.setCmp(less<int>(), less<int>());
    CDQ.run();
    for(int i=0;i<CDQ.N;++i) ans[i][0] = CDQ.Ans[i];

    // 第一维大第二维小，右下
    CDQ.setCmp(greater<int>(), less<int>());
    CDQ.run();
    for(int i=0;i<CDQ.N;++i) ans[i][1] = CDQ.Ans[i];

    // 两维都大，右上
    CDQ.setCmp(greater<int>(), greater<int>());
    CDQ.run();
    for(int i=0;i<CDQ.N;++i) ans[i][2] = CDQ.Ans[i];

    // 第一维小第二维大，左上
    CDQ.setCmp(less<int>(), greater<int>());
    CDQ.run();
    for(int i=0;i<CDQ.N;++i) ans[i][3] = CDQ.Ans[i];

    for(const auto & a : ans) cout << a[0] << " " << a[1] << " " << a[2] << " " << a[3] << "\n";
}


int main(){
#ifndef ONLINE_JUDGE
    // freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--){
        proc();
    }
    return 0;
}